<template>
	<view>
		<view class="photoList">
			<view class="photo" v-for="(item,index) in list">
				<u--image width="213rpx" height="213rpx" :src="item.url" mode="scaleToFill"
					@click="ckimg(item.url,type)"></u--image>
			</view>
		</view>
		<view class="nullBox" v-if="list.length==0">
			<image src="../../static/null.png" mode="widthFix"></image>
			<view>暂无数据</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				type: 1,
				pageNo: 1,

			}
		},
		onLoad(e) {
			this.type = e.type;
			if (this.type == 1) {
				this.API_img();
			} else {
				this.API_viedo();
			}
		},
		onShow() {
			// this.API_user()
		},
		onReachBottom() {
			if (this.type == 1) {
				this.API_img();
			} else {
				this.API_viedo();
			}
		},
		methods: {
			ckimg(url, type) {
				uni.navigateTo({
					url: '/pages/mine/viedo?type=' + type + '&srcs=' + url
				})
			},
			API_img() {
				var that = this;
				var pageNo = that.pageNo;
				that.ran
					.request('/app-api/system/user-model-media/page?pageNo=' + pageNo + '&pageSize=10&type=IMAGE', {},
						'GET')
					.then(res => {
						console.log(res);
						if (res.code == 200) {
							// that.list = res.data.list;
							if (res.data.list == '') {

							} else {
								that.list = that.list.concat(res.data.list);
								that.pageNo = that.pageNo + 1;
							}
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						}
					});
			},
			API_viedo() {
				var that = this;
				var pageNo = that.pageNo;
				that.ran
					.request('/app-api/system/user-model-media/page?pageNo=' + pageNo + '&pageSize=10&type=VIDEO', {},
						'GET')
					.then(res => {
						console.log(res);
						if (res.code == 200) {
							// that.list = res.data.list;
							if (res.data.list == '') {

							} else {
								that.list = that.list.concat(res.data.list);
								that.pageNo = that.pageNo + 1;
							}
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						}
					});
			},
		}
	}
</script>

<style lang="scss">
	.photoList {
		margin-left: 20rpx;
		overflow: hidden;
		margin-top: 50rpx;

		.photo {
			width: 213rpx;
			height: 213rpx;
			margin-left: 20rpx;
			overflow: hidden;
			float: left;
			border-radius: 10rpx;
			margin-bottom: 20rpx;

			image {
				width: 213rpx;
				height: 213rpx;
				display: block;
				// width: 100%;
			}
		}
	}
</style>